package com.example.shiwuyouproject.ui.fragment.my.activity.viewmodel

import androidx.lifecycle.MutableLiveData
import com.example.shiwuyouproject.base.BaseViewModel
import com.example.shiwuyouproject.ui.my.bean.PersonalInformationBean

class SuccessfulCaseViewModel:BaseViewModel() {

    private val getRealNameAuthenticatioApi by lazy { RetrofitClient.getApiService() }
    val getGenRenStatus = MutableLiveData<PersonalInformationBean>()
    fun getRealNameAuthenticationData(){
        launch(
            block = {
                val codeStatus = getRealNameAuthenticatioApi.userUpdate()
                getGenRenStatus.value=codeStatus.result()
            },
            error = {
            },
            cancel = {

            },
            showErrorToast = false
        )
    }
    val getPostStatus = MutableLiveData<Boolean>()
    /**
     * 成功案例
     *
     */
    fun preservationCard(case_title:String,
                         case_desc:String

    ){
        val hashMap:MutableMap<String, String> = HashMap()
        hashMap["case_title"] = case_title
        hashMap["case_desc"] = case_desc
        launch(
            block = {
                val codeStatus = getRealNameAuthenticatioApi.addUserUpdate(hashMap)
                getPostStatus.value=codeStatus.success()
            },
            error = {
                getPostStatus.value=false
            },
            cancel = {
                getPostStatus.value=false
            },
            showErrorToast = false
        )
    }
    /**
     * 教学特点
     *
     */
    fun jiaoxuetedian(feature:String

    ){
        val hashMap:MutableMap<String, String> = HashMap()
        hashMap["feature"] = feature
        launch(
            block = {
                val codeStatus = getRealNameAuthenticatioApi.addUserUpdate(hashMap)
                getPostStatus.value=codeStatus.success()
            },
            error = {
                getPostStatus.value=false
            },
            cancel = {
                getPostStatus.value=false
            },
            showErrorToast = false
        )
    }
}